package com.reptile.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.Objects;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("发送新闻类Vo")
public class NewsDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("新闻内容")
    private String content;

    @ApiModelProperty("新闻标题")
    private String title;

    @ApiModelProperty("新闻连接")
    private String url;

    @ApiModelProperty("新闻图片连接")
    private String pictureUrl;

    @ApiModelProperty("新闻时间")
    private LocalDate newsDate;

    @ApiModelProperty("爬取新闻时间")
    private LocalDate crawlingDate;

    @ApiModelProperty("新闻分类")
    private String newType;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        NewsDTO newsDTO = (NewsDTO) o;
        return content.equals(newsDTO.content) && title.equals(newsDTO.title) && url.equals(newsDTO.url) && newType.equals(newsDTO.newType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(content, title, url, newType);
    }
}
